-
-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order beforeModel and afterModel around model #124
Conversation
While I do like the idea of enforcing an order for the lifecycle hooks, I'm not sure whether this is the right way to do it. This is possibly just adding confusion, since we already have a
|
I mostly agree with @kevinkucharczyk , but I was also thinking about getting rid of
This way we would take advantage of currently available grouping feature and all other explicitly listed hooks would be treated equally. |
@kevinkucharczyk @michalsnik yeah, the idea was we should remove all lifecycle hooks and list them explicitly for ordering. This PR is not meant to be merged yet, but I wanted to get feedback on how I was doing things before I continued down the path. If you are both happy with how I implemented |
@kevinkucharczyk @michalsnik I added more route hooks, but not sure if I have gotten them all. It feels very verbose having a separate method to check like |
@rwwagner90 I agree, it is quite verbose. Perhaps you could define one |
We already have Then simple:
might be enough |
Thanks @michalsnik! Though I think it would still be good to introduce a separate method for just the route lifecycle hooks. |
@kevinkucharczyk @michalsnik thanks for those suggestions! I made an
|
@kevinkucharczyk @michalsnik any other tweaks you would like? I can start on the component one as well, if this looks good 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny cleanup and we're good to 🚀
lib/utils/ember.js
Outdated
].indexOf(name) > -1; | ||
} | ||
|
||
function isRouteMethod(name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can actually remove this method.
We should replace in above code isRouteMethod
with isRouteLifecycleHookName
and additionally remove isRouteDefaultMethod
too.
Additionally please fix eslint issue so the build is green @rwwagner90 :) |
@michalsnik I removed those two methods and fixed ESLint. Please let me know if there is anything else I should do. |
Also, I suppose I should update the docs to reflect these new changes, right? |
Yeah, please update docs too. I'm only worried about backwards compatibility. I would preferably release it in minor update, but in it's current state it will most likely be a breaking change. If we make sure however that
So summarising:
This way we'll be able to introduce this change as in the minor release. And then together with new rules that we added recently we'll update default recommendations and do one major release. What do you think guys? @rwwagner90 @kevinkucharczyk |
@michalsnik that sounds like a lot of work to support both. I'd prefer to not do that. We could just update models and components and docs all as part of this PR too, and get it in for the next breaking change. |
We could do that, but the change might not be so complicated after all, all you'd need to do is to parse settings and replace |
@michalsnik I think I implemented what you are referring to in my last commit. Please let me know if you think this will work! |
We should add more tests now, as we can pass different settings per test and make sure it works as expected with both settings :) |
But overall looks good, I expect it to work properly. Though I'll test it manually too |
@michalsnik there is a test that I accidentally left |
@michalsnik I added a couple more tests, and updated the docs. Please let me know if I should do anything else 😄 |
@michalsnik anything else I need to do before we can merge this in? Should I do components and models as part of the same PR or do them separate later? |
@michalsnik @kevinkucharczyk anything stopping us from merging this? |
@michalsnik @kevinkucharczyk haven't heard from you guys in awhile. Could one of you please give this one more quick look and merge it in? I think it's good to go. |
Hey, sorry @rwwagner90 I've been quite busy recently and now I'm on a vacation. I'll take a look in the next week, I hope it's fine :) |
@michalsnik that's fine, didn't realize you were on vacation. Thanks for the reply 😄 |
@michalsnik by next week, did you mean this week or the following week? |
Alright, I think we're good @rwwagner90 . I resolved some conflicts and will merge it as soon as the travis check passes 🚀 Great job! And sorry for such a delay. |
Thanks @michalsnik! I appreciate your help and the merge 😄 . I just put up another PR to handle lifecycle hook ordering in components. |
I'm working on enforcing that route lifecycle hooks are in order by default. The first step I did was beforemodel -> model -> afterModel. I wasn't sure if it made sense to merge this separately, or at least review it and let me know if it is done correctly.